<?php

class Webmix_Form_Company_Create extends Engine_Form
{
  public function init()
  {
      $this->clearDecorators()
//      ->addDecorator('FormElements')
//      ->addDecorator('Form')
      ->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));

        $this->setTitle('Create Block');
        
        $countryTB = Engine_Api::_()->getDbTable('countries','webmix');
        $countries = $countryTB->fetchAll($countryTB->select()->where('selected =1'));  
        $country_prepare = array();
        foreach($countries as $country){
            $country_prepare[$country->country_id] = $country->title;
        }  
        
        
        $this->addElement('text','title',array(
            'label'=>'Company name',
			'required' =>true,
            'allowEmtry'=>false,
            'validators' => array (
					array (
						'NotEmpty', 
						true
					)
			)                                             
        ));
        
        $this->addElement('text','link',array(
            'label'=>'Link',
			'required' =>true,
            'allowEmtry'=>false,
            'validators' => array (
					array (
						'NotEmpty', 
						true
					)
			)                                  
        ));
         
        $this->addElement('Select', 'country_id', array(
	        'label' => 'Country',
	        'multiOptions' => $country_prepare,
        ));
             
       	$this->addElement('Button', 'image_upload', array (
			'label' => 'Upload Image', 
            'onclick' => 'openUploadform()',
			'decorators' => array (
				'ViewHelper'
			)
		));     
        
       $this->addElement('Hidden', 'file_id', array('order' => 100));     
       $this->addElement('Hidden', 'comp_id', array('order' => 101)); 
       $this->addElement('Hidden', 'action_type', array('order' => 102));      
       
       $this->addElement('Select','backgound',array(
            'label' =>'Backgound',
            'multiOptions' => array(
                'white' =>'White',
                'green' =>'green',
                'pink' =>'pink',
                'black' =>'black',
                'blue' =>'blue',
                'orange' =>'orange',
                'red' =>'red',
                'brown' =>'brown'
            ),
        ));
       
       	$this->addElement('Button', 'submit', array (
			'label' => 'Submit', 
			'type' => 'submit',
			'decorators' => array (
				'ViewHelper'
			)
		)); 
       
		$this->addElement('Cancel', 'cancel', array (
				'label' => 'cancel', 
				'link' => true, 
				'href' => '', 
                'onclick' => 'cancelCreate();',
				'decorators' => array (
						'ViewHelper'
				)
		));               

		$this->addDisplayGroup(
			array (
				'submit', 
				'cancel'
			), 'buttons', array ()
		);            
  }
}  